package ycl.system.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import ycl.common.base.entity.BaseEntity;
import ycl.common.constants.BaseConstant;

import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * <p>
 * 用户表
 * </p>
 *
 * @author ycl
 * @since 2022-03-03 11:43:57
 */
@Getter
@Setter
@Accessors(chain = true)
@TableName("sys_user")
@ApiModel(value = "SysUser对象", description = "用户表")
public class SysUser extends BaseEntity {

	private static final long serialVersionUID = 1L;

	@ApiModelProperty("用户名")
	@TableField("username")
	private String username;

	@ApiModelProperty("密码")
	@TableField("password")
	private String password;

	@ApiModelProperty("加密盐")
	@TableField("salt")
	private String salt;

	@ApiModelProperty("用户头像")
	@TableField("avatar")
	private String avatar;

	@ApiModelProperty("真实名")
	@TableField("real_name")
	private String realName;

	@ApiModelProperty("身份证")
	@TableField("id_card")
	private String idCard;

	@ApiModelProperty("性别，1男，0女")
	@TableField("sex")
	private Boolean sex;

	@ApiModelProperty("注册时间")
	@JsonFormat(pattern = BaseConstant.DATE_PATTERN ,timezone = BaseConstant.DATE_TIME_GMT8)
	private LocalDate birthday;

	@ApiModelProperty("登录信息")
	@TableField("token")
	private String token;

	@ApiModelProperty("用户类型，0超管，1普通用户")
	@TableField("type")
	private Integer type;

	@ApiModelProperty("邀请码")
	@TableField("invitation_code")
	private String invitationCode;

	@ApiModelProperty("父id，邀请人的id")
	@TableField("parent_id")
	private Long parentId;

	@ApiModelProperty("手机号")
	@TableField("mobile")
	private String mobile;

	@ApiModelProperty("微信id")
	@TableField("wechat_id")
	private String wechatId;

	@ApiModelProperty("状态，0正常，1禁用")
	@TableField("status")
	private Integer status;

	@ApiModelProperty("注册时间")
	@TableField("register_time")
	@JsonFormat(pattern = BaseConstant.DATE_TIME_PATTERN ,timezone = BaseConstant.DATE_TIME_GMT8)
	private LocalDateTime registerTime;

	@ApiModelProperty("是否锁住，锁住不可登录，0否，1是")
	@TableField("locked")
	private Boolean locked;

	@ApiModelProperty("登录地址")
	@TableField("login_ip")
	private String loginIp;

	@ApiModelProperty("登录时间")
	@TableField("login_time")
	@JsonFormat(pattern = BaseConstant.DATE_TIME_PATTERN ,timezone = BaseConstant.DATE_TIME_GMT8)
	private LocalDateTime loginTime;

	@ApiModelProperty("上次登录时间")
	@TableField("last_login_time")
	@JsonFormat(pattern = BaseConstant.DATE_TIME_PATTERN ,timezone = BaseConstant.DATE_TIME_GMT8)
	private LocalDateTime lastLoginTime;

	@ApiModelProperty("上次登录地址")
	@TableField("last_login_ip")
	private String lastLoginIp;

	@ApiModelProperty("退出时间")
	@TableField("logout_time")
	@JsonFormat(pattern = BaseConstant.DATE_TIME_PATTERN ,timezone = BaseConstant.DATE_TIME_GMT8)
	private LocalDateTime logoutTime;


}
